package com.bgs.travelapp.order.mapper;

import com.bgs.travelapp.mapper.BaseMapper;
import com.bgs.travelapp.order.entity.ScenicOrderEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * fys 2022年8月4日11:02:47
 * 购票系统SQL
 */
public interface PurchaseMapper extends BaseMapper<ScenicOrderEntity> {

    /**
     * 修改景区订单状态(已支付)
     * @param scenicTicketEntity
     * @return
     */
    @Update("UPDATE scenic_order SET order_status=1 where order_No = #{scenicTicketEntity.orderNo}")
    Integer UpdateScenicticketStatus(@Param("scenicTicketEntity") ScenicOrderEntity scenicTicketEntity);

    /**
     * 修改景区订单状态（已取消）
     * @param scenicTicketEntity
     * @return
     */
    @Update("UPDATE scenic_order SET order_no = #{scenicTicketEntity.orderNo}")
    Integer UpdateScenicticketStatus1(@Param("scenicTicketEntity") ScenicOrderEntity scenicTicketEntity);

    /**
     * 订单未支付，支付超时，修改该订单状态为：已取消
     * @param orderCode
     * @param orderStatus
     */
    @Update("update scenic_order set order_status = #{orderStatus} WHERE order_no = #{orderCode}")
    void updateOrderStatus(@Param("orderCode") String orderCode,@Param("orderStatus") Integer orderStatus);

}
